﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>demonstrate horizontal menu</title>
    <style type="text/css">
        #horizonMenu
        {
            float: left;
            list-style-type: none;
            padding: 0;
            width: 100%; /*to let it occupy the whole line,preventing following to round*/
        }
        #horizonMenu li
        {
            display: inline;
        }
        #horizonMenu a
        {
            float: left;
            text-decoration: none;
            color: white;
            background-color: purple;
            border-right: 1px solid white;
            padding: 0.2em 0.6em;
            width: 6em; /*width only take effect when 'a' floats*/
        }
        #horizonMenu a:hover
        {
            background-color: #ff3300;
        }
    </style>
</head>
<body>
    <ul id="horizonMenu">
        <li><a href="#">Link one</a></li>
        <li><a href="#">Link two</a></li>
        <li><a href="#">Link three</a></li>
        <li><a href="#">Link four</a></li>
    </ul>
    <p>
        In the example above, we let the ul element and the a element float to the left.
        The li elements will be displayed as <b>inline elements (no line break before or after
            the element)</b>. This forces the list to be on one line. The ul element has
        a width of 100% and each hyperlink in the list has a width of 6em (6 times the size
        of the current font). We add some colors and borders to make it more fancy.
    </p>
</body>
</html>
